import Vue from "vue";
import VueRouter from "vue-router";
import Home from "@/views/home";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "/",
    redirect: "/home",
    meta: { title: "首页" },
  },
  {
    path: "/home",
    name: "home",
    component: Home,
    meta: { title: "首页" },
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

const VueRouterPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch((err) => err);
};

export default router;
